home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / arrang1g / led.ctl next >
Text File  |  1998-11-19  |  15KB  |  429 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
  3. Begin VB.UserControl LED 
  4.    ClientHeight    =   300
  5.    ClientLeft      =   0
  6.    ClientTop       =   0
  7.    ClientWidth     =   300
  8.    ScaleHeight     =   20
  9.    ScaleMode       =   3  'Pixel
  10.    ScaleWidth      =   20
  11.    ToolboxBitmap   =   "LED.ctx":0000
  12.    Begin VB.Timer Timer1 
  13.       Enabled         =   0   'False
  14.       Interval        =   1000
  15.       Left            =   1020
  16.       Top             =   1500
  17.    End
  18.    Begin VB.Image Image1 
  19.       Height          =   300
  20.       Left            =   0
  21.       Stretch         =   -1  'True
  22.       Top             =   0
  23.       Width           =   300
  24.    End
  25.    Begin ComctlLib.ImageList ImageList1 
  26.       Left            =   2100
  27.       Top             =   1500
  28.       _ExtentX        =   1005
  29.       _ExtentY        =   1005
  30.       BackColor       =   -2147483643
  31.       ImageWidth      =   20
  32.       ImageHeight     =   20
  33.       MaskColor       =   12632256
  34.       _Version        =   327682
  35.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  36.          NumListImages   =   18
  37.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  38.             Picture         =   "LED.ctx":0312
  39.             Key             =   "RedCirLo"
  40.          EndProperty
  41.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  42.             Picture         =   "LED.ctx":0814
  43.             Key             =   "RedCirHi"
  44.          EndProperty
  45.          BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  46.             Picture         =   "LED.ctx":0D16
  47.             Key             =   "GreCirLo"
  48.          EndProperty
  49.          BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  50.             Picture         =   "LED.ctx":1218
  51.             Key             =   "GreCirHi"
  52.          EndProperty
  53.          BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  54.             Picture         =   "LED.ctx":171A
  55.             Key             =   "RedSqeLo"
  56.          EndProperty
  57.          BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  58.             Picture         =   "LED.ctx":1C1C
  59.             Key             =   "RedSqeHi"
  60.          EndProperty
  61.          BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  62.             Picture         =   "LED.ctx":211E
  63.             Key             =   "GreSqeLo"
  64.          EndProperty
  65.          BeginProperty ListImage8 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  66.             Picture         =   "LED.ctx":2620
  67.             Key             =   "GreSqeHi"
  68.          EndProperty
  69.          BeginProperty ListImage9 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  70.             Picture         =   "LED.ctx":2B22
  71.             Key             =   "YelCirLo"
  72.          EndProperty
  73.          BeginProperty ListImage10 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  74.             Picture         =   "LED.ctx":3024
  75.             Key             =   "YelCirHi"
  76.          EndProperty
  77.          BeginProperty ListImage11 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  78.             Picture         =   "LED.ctx":3526
  79.             Key             =   "YelSqeLo"
  80.          EndProperty
  81.          BeginProperty ListImage12 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  82.             Picture         =   "LED.ctx":3A28
  83.             Key             =   "YelSqeHi"
  84.          EndProperty
  85.          BeginProperty ListImage13 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  86.             Picture         =   "LED.ctx":3F2A
  87.             Key             =   "ButtonUp"
  88.          EndProperty
  89.          BeginProperty ListImage14 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  90.             Picture         =   "LED.ctx":55A8
  91.             Key             =   "ButtonDown"
  92.          EndProperty
  93.          BeginProperty ListImage15 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  94.             Picture         =   "LED.ctx":6C26
  95.             Key             =   "KeyOff"
  96.          EndProperty
  97.          BeginProperty ListImage16 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  98.             Picture         =   "LED.ctx":A2D8
  99.             Key             =   "KeyOn"
  100.          EndProperty
  101.          BeginProperty ListImage17 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  102.             Picture         =   "LED.ctx":D98A
  103.             Key             =   "KeyOffwo"
  104.          EndProperty
  105.          BeginProperty ListImage18 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  106.             Picture         =   "LED.ctx":F2F4
  107.             Key             =   "KeyOnwo"
  108.          EndProperty
  109.       EndProperty
  110.    End
  111. End
  112. Attribute VB_Name = "LED"
  113. Attribute VB_GlobalNameSpace = False
  114. Attribute VB_Creatable = True
  115. Attribute VB_PredeclaredId = False
  116. Attribute VB_Exposed = False
  117.  
  118. 'Default Property Values:
  119. Const m_def_ButtonMode = 0
  120. Const m_def_LEDColor = 0
  121. Const m_def_Shape = 0
  122. Const m_def_Value = False
  123. 'Property Variables:
  124. Dim m_ButtonMode As enButtMode
  125. Dim m_LEDColor As enLedColor
  126. Dim m_Shape As LedShape
  127. Dim m_Value As Boolean
  128. 'Event Declarations:
  129. Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=Image1,Image1,-1,MouseDown
  130. Attribute MouseDown.VB_Description = "Occurs when the user presses the mouse button while an object has the focus."
  131. Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=Image1,Image1,-1,MouseUp
  132. Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus."
  133. Event Click() 'MappingInfo=Image1,Image1,-1,Click
  134.  
  135. Enum LedShape
  136.     ledCircle = 0
  137.     ledSquare = 1
  138.     ledButton = 2
  139. End Enum
  140.  
  141. Enum enLedColor
  142.     ledRed = 0
  143.     ledGreen = 1
  144.     ledYellow = 2
  145. End Enum
  146.  
  147. Enum enButtMode
  148.     ledPushButton = 0
  149.     ledSwitch = 1
  150. End Enum
  151.  
  152.  
  153. Public Property Get LEDColor() As enLedColor
  154. Attribute LEDColor.VB_Description = "Color of LED"
  155. Attribute LEDColor.VB_ProcData.VB_Invoke_Property = ";Appearance"
  156. Attribute LEDColor.VB_MemberFlags = "200"
  157.     LEDColor = m_LEDColor
  158. End Property
  159.  
  160. Public Property Let LEDColor(ByVal New_LEDColor As enLedColor)
  161.     m_LEDColor = New_LEDColor
  162.     PropertyChanged "LEDColor"
  163.     Call Nastavi
  164. End Property
  165.  
  166. Public Property Get Shape() As LedShape
  167. Attribute Shape.VB_Description = "Shape of LED"
  168. Attribute Shape.VB_ProcData.VB_Invoke_Property = ";Appearance"
  169.     Shape = m_Shape
  170. End Property
  171.  
  172. Public Property Let Shape(ByVal New_Shape As LedShape)
  173.     
  174.     m_Shape = New_Shape
  175.     PropertyChanged "Shape"
  176.     Call Nastavi
  177. End Property
  178.  
  179. Public Property Get Value() As Boolean
  180. Attribute Value.VB_ProcData.VB_Invoke_Property = ";Data"
  181.     Value = m_Value
  182. End Property
  183.  
  184. Public Property Let Value(ByVal New_Value As Boolean)
  185.     m_Value = New_Value
  186.     PropertyChanged "Value"
  187.     Call Nastavi
  188. End Property
  189.  
  190. Private Sub Timer1_Timer()
  191. Static test As Boolean
  192.     If m_Shape = 0 Then
  193.         If m_LEDColor = 0 Then
  194.             If test = False Then
  195.                 Image1.Picture = ImageList1.ListImages("RedCirLo").Picture
  196.                 test = True
  197.             Else
  198.                 Image1.Picture = ImageList1.ListImages("RedCirHi").Picture
  199.                 test = False
  200.             End If
  201.         ElseIf m_LEDColor = 1 Then
  202.             If test = False Then
  203.                 Image1.Picture = ImageList1.ListImages("GreCirLo").Picture
  204.                 test = True
  205.             Else
  206.                 Image1.Picture = ImageList1.ListImages("GreCirHi").Picture
  207.                 test = False
  208.             End If
  209.         Else
  210.             If test = False Then
  211.                 Image1.Picture = ImageList1.ListImages("YelCirLo").Picture
  212.                 test = True
  213.             Else
  214.                 Image1.Picture = ImageList1.ListImages("YelCirHi").Picture
  215.                 test = False
  216.             End If
  217.         End If
  218.     ElseIf m_Shape = 1 Then
  219.         If m_LEDColor = 0 Then
  220.             If test = False Then
  221.                 Image1.Picture = ImageList1.ListImages("RedSqeLo").Picture
  222.                 test = True
  223.             Else
  224.                 Image1.Picture = ImageList1.ListImages("RedSqeHi").Picture
  225.                 test = False
  226.             E